using System;
using System.Windows.Forms;

namespace QuanLyPhongKham
{
    public partial class frmChonkho : BaseUserControl
    {
        private DAL.AccessData m;
        public int i_makho = 0;
        public string s_tenkho = "", s_mmyy = "";

        public frmChonkho(DAL.AccessData acc)
        {
            this.m = acc;
            InitializeComponent();
        }

        private void butKetthuc_Click(object sender, EventArgs e)
        {
            //this.Close();
        }

        private void butDongy_Click(object sender, EventArgs e)
        {
            i_makho=int.Parse(kho.SelectedValue.ToString());
            s_tenkho = kho.Text;
            s_mmyy = mm.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().Substring(2);
            //this.Close();
        }

        private void frmChonkho_Load(object sender, EventArgs e)
        {
            mm.Value = decimal.Parse(DateTime.Now.Month.ToString());
            decimal t = decimal.Parse(DateTime.Now.Year.ToString());
            yyyy.Maximum = t + 3;
            yyyy.Value = t;
            kho.DisplayMember = "TEN";
            kho.ValueMember = "ID";
            kho.DataSource = m.get_data("select id,ten from " + m.user + ".d_dmkho order by id").Tables[0];
            kho.SelectedIndex = 0;
        }
    }
}